Skip to main content

πŸ“¦ Resize Root Disk on AWS EC2 (30 GB ➜ 50 GB)

This guide explains how to increase disk size on an AWS EC2 instance when the disk is full and ensure the OS recognizes the new space.


🟒 Step 1: Modify EBS Volume from AWS Console​

  1. Go to AWS EC2 Console
  2. Navigate to EC2 β†’ Volumes
  3. Select the attached root volume
  4. Click Modify volume
  5. Change the size from 30 GB to 50 GB
  6. Click Modify and confirm

⏳ Wait until the Volume State becomes in-use again.


🟒 Step 2: Verify Disk Size on Server​

Login to the EC2 instance and check disk usage:

df -h

You will still see the old filesystem size, for example:

Filesystem       Size  Used Avail Use% Mounted on
/dev/root 29G 9.2G 19G 33% /

This is expected because only the volume was resized, not the partition or filesystem.


🟒 Step 3: Check Block Devices​

lsblk

Output (volume resized, partition not yet):

nvme0n1      259:0    0   50G  0 disk
β”œβ”€nvme0n1p1 259:1 0 29G 0 part /

πŸ“Œ Here, the disk is 50 GB, but the root partition is still 29 GB.


🟒 Step 4: Install Required Utilities​

Install cloud utilities required to grow partitions:

sudo apt update
sudo apt install cloud-guest-utils -y

🟒 Step 5: Grow the Root Partition​

Extend partition 1 of disk nvme0n1:

sudo growpart /dev/nvme0n1 1

Verify again:

lsblk

Expected output:

nvme0n1      259:0    0   50G  0 disk
β”œβ”€nvme0n1p1 259:1 0 49G 0 part /

βœ… Partition is now resized.


🟒 Step 6: Resize the Filesystem (IMPORTANT ⚠️)​

Even after growing the partition, the filesystem still uses the old size. Resize it using:

sudo resize2fs /dev/nvme0n1p1

🟒 Step 7: Final Verification πŸŽ‰β€‹

df -h

Expected output:

Filesystem       Size  Used Avail Use% Mounted on
/dev/root 49G 9.2G 38G 20% /

πŸŽ‰ Disk space successfully increased from 30 GB to 50 GB!


🧠 Key Notes​

  • 🟑 Volume resize β‰  filesystem resize
  • 🟑 Always run growpart + resize2fs
  • 🟑 No reboot required in most cases
  • 🟒 Works for ext4 filesystems (default Ubuntu)

πŸ“Œ One-Line Summary​

Modify volume β†’ grow partition β†’ resize filesystem πŸš€